package ca.concordia.soen6011.interfaces;

import ca.concordia.soen6011.Result;
import ca.concordia.soen6011.exceptions.InfinityOutputException;
import ca.concordia.soen6011.exceptions.UndefinedOutputException;

/**
 * MathFunction interface
 * -----------------------------------------------------
 * 
 * Defines the contract for each transient math function
 * that has to implemented by different team members
 * 
 * @author Zhang, Dan
 * @since July-August 2014
 * 
 *        *****************************************************************
 *        TRANSIENT FUNCTION CALCULATOR is a team project for the SOEN 6011
 *        course delivered by Dr. Kamthan, Pankaj at Concordia University,
 *        Montreal for the summer 2014 session.
 *        *****************************************************************
 */
public interface MathFunction {
	
	/**
	 * Validates the input for the method e.g. if there is any inputs that
	 * a particular method cannot deal with, this function should be used
	 * to throw the exception
	 * 
	 * @param x The input value
	 * @param precision The required precision
	 * @throws Exception The exception thrown
	 */
	void validate(double x, double precision) throws Exception;
	

	/**
	 * The method that computes the result based on the user's inputs of 
	 * x and precision. Computes the result, creates the Result POJO and
	 * returns it
	 * 
	 * @param x The user input
	 * @param precision The required precision
	 * @return The Result object tht has been computed
	 * @throws InfinityOutputException
	 * @throws UndefinedOutputException
	 */
	public Result compute (double x, double precision) throws InfinityOutputException, UndefinedOutputException;
	
	/**
	 * Returns the name of the function
	 * 
	 * @return The name of the function
	 */
	public String getName();
}